package edu.ucla.cs.CalorieCounter;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class CalorieModelHelper extends SQLiteOpenHelper {
	private static final String DATABASE_NAME = "Calorie.db";
	public static final String TABLE_NAME = "Calorie";
	
	public static final String NAME = "name";
	public static final String CALORIE_BURNED = "calorieBurned";
	public static final String TIME_STAMP = "timeStamp";
	
	
	public CalorieModelHelper(Context context) {
		super(context, DATABASE_NAME, null, 1);
	}
	
	public void onCreate(SQLiteDatabase db){
		db.execSQL("CREATE TABLE Calorie (_id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, calorieBurned REAL, timeStamp TEXT);");
	}
	
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion){
		android.util.Log.v("Constants", "Upgrading database");
		db.execSQL("Drop table if exists " + TABLE_NAME);
		onCreate(db);
	}	
}
